package reflectPracticeDemo;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

public class put_String_to_ArrayListInteger {

	public static void main(String[] args) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
		ArrayList<Integer> array = new ArrayList<Integer>();
		
		array.add(11);

		
		Class<? extends ArrayList> class1 = array.getClass();
		Method add_m = class1.getMethod("add",Object.class);
		add_m.invoke(array, "hello");
		add_m.invoke(array, "world");
		add_m.invoke(array, "java");
		
		System.out.println(array);
		

	}

}
